package com.zhuangjie.shop.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.zhuangjie.mvc.validator.annotate.ValidNumberEnumsString;
import com.zhuangjie.mvc.validator.annotate.ValidTimeRangeString;
import com.zhuangjie.mvc.validator.valid.DefaultGroup;
import com.zhuangjie.mvc.validator.valid.UpdateGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 店铺创建的活动实例
 * </p>
 *
 * @author zhuangjie
 * @since 2024-03-13
 */
@Data
@TableName(value = "shop_activity_instance")
@ApiModel(value = "ShopActivityInstance对象", description = "")
public class ShopActivityInstance implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("参与活动id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @NotNull(groups = UpdateGroup.class,message = "更新必须带id")
    private Long id;

    @ApiModelProperty("店铺id")
    @TableField("shop_id")
    private Long shopId;

    @ApiModelProperty("活动id")
    @TableField("activity_id")
    @NotNull(groups = DefaultGroup.class, message = "活动类型id不能为空")
    private Long activityId;

    @ApiModelProperty("活动名（自动生成，如满12减2）")
    @TableField("title")
    private String title;

    @ApiModelProperty("门槛（各类型表示的值不同）")
    @TableField("threshold")
    private String threshold;

    @ApiModelProperty("优惠值类型（1:按金额 2:按折扣 3:活动特征值）")
    @TableField("value_type")
    private Byte valueType;

    @ApiModelProperty("优惠值")
    @TableField("value")
    private String value;

    @ApiModelProperty("适用顾客类型（0:全部用户 1:会员 2 新客 ）")
    @TableField("customer_type")
    private Short customerType;

    @ApiModelProperty("活动开始时间")
    @TableField("start_date")
    @NotNull(groups = DefaultGroup.class, message = "活动开始时间不能为空")
    private LocalDateTime startDate;

    @ApiModelProperty("活动结束时间")
    @TableField("end_date")
    private LocalDateTime endDate;

    @ApiModelProperty("适用的周(1,2,3...,7)")
    @TableField(value = "weeks")
    @ValidNumberEnumsString(groups = DefaultGroup.class ,delimiter = ",")
    private String weeks;

    @ApiModelProperty("适用的时间段(12:00-14:00,...)")
    @TableField("time_ranges")
    @ValidTimeRangeString(groups = DefaultGroup.class, delimiter = ",")
    private String timeRanges;

    @ApiModelProperty("创建时间")
    @TableField(value = "create_time", fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty("更新时间")
    @TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}
